#include "LinkList.h"

void main()
{
    LinkList L;
    InitList(&L);
    DataType e;
    int i;
    if (L)
    {
        printf("Init Success\n");
    }
    if (isEmpty(L))
    {
        printf("It is empty.\n");
    }
    for (i = 0; i < 10; i++)
    {
        InsertElem(L, i + 1, i);
    }
    if (GetElem(L, 1, &e))
    {
        printf("The first elem is %d\n", e);
    }
    printf("length is %d\n", GetLength(L));

    printf("The 5 at %d\n", FindData(L, 5, *compare));

    PreElem(L, 6, &e);
    printf("The 6's previous element is %d\n", e);

    NextElem(L, 6, &e);
    printf("The 6's next element is %d\n", e);

    DeleteElem(L, 1, &e);
    printf("delete first element is %d\n", e);

    printf("list:");
    TraverseList(L, Visit);

    DestroyList(&L);
    if (!L)
    {
        printf("\ndestroy success\n");
    }
}